﻿using System;
using System.Configuration;
using System.Web.Http;
using Sustainalytics.DataLayer.ConnectionStrings;
using Sustainalytics.DataLayer.Shared;
using Sustainalytics.Entities;
using Sustainalytics.Entities.ConnectionStrings;
using Sustainalytics.Entities.Governance;
using System.Web.Http.Cors;

namespace Sustainalytics.Governance.Service.Controllers
{
    [EnableCors(origins: "*", headers: "*", methods: "*")]
    [RoutePrefix("api/v1/company")]
    public class GovernanceOverallCompanyPerformance:ApiController
    {
        private readonly IRepositoryCollection<GovernanceComputationResult> _repositoryCompResult;
        private readonly IRepositoryCollection<GovernanceCompanyProfile> _repositoryCompanyProfile; 

        public GovernanceOverallCompanyPerformance()
        {
            var connectionStringsManager =
                ConnectionStringsManager.GetInstance(
                    ConnectionStringsRepository.GetInstance(ConfigurationManager.ConnectionStrings["ClientPlatform"].ConnectionString));
            _repositoryCompResult =
                new RepositoryCollection<GovernanceComputationResult>(
                    connectionStringsManager.GetConnectionString(ConnectionStringType.GovernanceDW));
            _repositoryCompanyProfile = new RepositoryCollection<GovernanceCompanyProfile>(
                    connectionStringsManager.GetConnectionString(ConnectionStringType.GovernanceDW));
        }
    }
}
